# Define the list of required packages
required_packages <- c(
  "ggh4x", "tidyverse", "haven", "stargazer", "broom", "lmtest","sandwich", 
  "ggeffects", "texreg", "kableExtra", "labelled"
)

# Identify packages that are not installed
missing_packages <- required_packages[!(required_packages %in% installed.packages()[,"Package"])]

# Install missing packages
if(length(missing_packages) > 0) {
  install.packages(missing_packages)
}
